package com.xie.springCloud.service;

import com.xie.springCloud.pojo.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class DeptFallFallbackFactory implements FallbackFactory {
    public IDeptService create(Throwable throwable) {
        return new IDeptService() {
            public Dept getById(Long id) {
                return new Dept().setId(id).setName("服务已关闭！").setDb_source("请联系开发谢工");
            }

            public List<Dept> getList() {
                return null;
            }

            public boolean addDept(Dept dept) {
                return false;
            }
        };
    }
}
